<?php





include_once(abspath.'/includes/funcs/function_absolute.php');
$db = new Database(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE); 

$category = null;
$aboutChannel = array();
$cId = "all";
$catID = 0;
if(!empty($_GET['c'])){
	$cId = $_GET['c'];
	$category = getCategory($_GET['c']);
	$catID = $cId;
}
$aboutChannel = getAboutChannelCategory($catID);

$iconCat = "/images/icon-livematches.png";
if(!empty($category)){
	if($category['icon'] != null) $iconCat = "/upload/".$category['icon'];
}
?>


<div class="container">
	<div class="main">
		<div class="streams">
		</div>
		<div class="content">
			<div class="main-area">
				<!-- background: url("../images/icon-livematches.png") no-repeat scroll 0 0 transparent; -->
				<div class="contentheader" >
					<div class="headerbg">
						<div class="icon-livematches" style='background: url("<?php echo $iconCat;?>") no-repeat scroll 0 0 transparent;'></div>
					</div>
					<span class="headertext">
					<?php
					if(!empty($_GET['c'])){
						echo "Live ";
						if(!empty($category)){
							echo $category['alias'];
						}
					}else{
						echo "Live Matches";
					}
					?>
					</span>
				</div>
				<div class="area main-area-border">
					<style type="text/css"></style>

					<div style="display:none" class="event-container">
						<a href="javascript:void(0)" onclick="showEvents()"><strong>Back to events</strong></a>
						<div class="event-block"></div>
					</div>
					<table align="center" cellpadding="0" cellspacing="0" width="100%" border="0" class="component lshoutsidetab">
						<tr>
							<td colspan="2">
								<!-- main container of tabs and slides -->
								</dl>
								<div class="lshcurrent">
									<!-- main container of slides -->
									<dd id="secevents0" class="lshdd"  >
										<!-- section description with img -->
										<table width="100%" class="sectiontable" cellpadding="0" cellspacing="0" border="0" style="padding: 0px;">
											<tr>
												<td style="display:none" class="debanner" id="debanner" align="center" colspan="2"><a href="http://affiliates.score-affiliates.com/processing/clickthrgh.asp?btag=a_112196b_1814">
													<img src="<?php echo baseurl;?>images/sprt_football_generic_bet10get30_468x60_de.gif" /></a></td>
											</tr>
											<!--tr>
												<td>fdsafd/td>
												<td valign="middle" align="right" width="10" height="10" >fds fd </td>
											</tr-->
											
										</table>
										
										<!-- main container after dd for sliders -->
										<div id="event-pane" class="lshpane-sliders">
											<div class="events_day d21_11_2013" >
												<span class="date"></span>        <!-- main container of a slide -->

							
													<div id="dataAboutChannels">
														

													</div>
													<script id="tmpdataAboutChannels" type="text/x-jquery-tmpl">

															<div class="lshpanel" id="e2121">
																<h3 class=" lshtitle eventtitle2121 about-channel-h3  lshjpane-toggler-down" style="background: url('images/${icon}') no-repeat scroll right center #F6F6F6;">
																	<table cellpadding="0" cellspacing="0" border="0">
																		<tbody>
																			<tr>
																				<td valign="middle" width="20px;" height="20px;" style="padding:0px 0px 0px 5px; background: url('images/info-icon.png') no-repeat scroll  center;"></td>
																				<td valign="middle" style="padding:0px 0px 0px 5px;">
																					<span class="lshevent">
																						${title}
																					</span>
																				</td>
																			</tr>
																		</tbody>
																	</table>
																</h3>
																<h3 id="preloadevent2121" style="display:none" class="preload-lshjpane-toggler"></h3>
																<!-- slider area -->
																<div  id="event2121" class="lshjpane-slider lshcontent" style=" display:none;padding-top: 0px; border-top-width: medium; border-top-style: none; padding-bottom: 0px; border-bottom-width: medium; border-bottom-style: none; overflow: hidden; ">
																	<table width="100%" class="insideslidebg" cellpadding="0" cellspacing="0" border="0">
																		<tbody>
																			<tr>
																				<td class="infoblock" colspan="2"><b>${about} </b>
																					
																				</td>
																			</tr>
																			<tr>
																				<td colspan="2">
																					${des}
																				</td>
																			</tr>
																		</tbody>
																	</table>
																</div>
																<!-- close slider area -->
															</div>
														
														</script>
													<script>
													var aboutChannel = <?php echo @json_encode($aboutChannel);?>;

													$().ready(function(e){
														var iaboutChannel = $.tmpl($("#tmpdataAboutChannels"), aboutChannel);
														$("#dataAboutChannels").html(iaboutChannel);
													});
													
													</script>
													<div class="row_custom">
														<!--
														<h1>
														-->
													   <br><h6>Upcoming Events   </h6>
															<span class="date"><script>
															var d=new Date();
															document.write(d);
														</script>
															
														<!--
														</h1>
														-->
													</div>
													<div id="dataChannels">
														
														<?php
														

														$rows = listChannels('channels.created desc',$cId);
														$channels = array();
														$cnt = 0;
														while ($record= $db->fetch_array($rows)) {
															$embled = getEmbledChannel($record['channel_id']);

															$channels[$cnt] = $record;
															$channels[$cnt]['flash'] = $embled;
															$cnt++;
														}
														
														$rows = listChannelsSchedule('channels.created desc',$cId,'channels.date_watch="'.date("Y-m-d").'"');
														$channelsCurr = array();
														$cnt = 0;
														while ($record= $db->fetch_array($rows)) {
															$embled = getEmbledChannel($record['channel_id']);

															$channelsCurr[$cnt] = $record;
															$channelsCurr[$cnt]['flash'] = $embled;
															$cnt++;
														}
														?>
														
														
														
													</div>
												<div id="ppStreams" style="display:none; width:800px; height:600px;">
													Loading...
												</div>
												<!-- close main container of a slide -->
											</div>
										</div>
										<div class="row_custom">
											Schedule <script>var d=new Date();
											var y = d.getFullYear();
											var m = d.getMonth()+1;
											var d = d.getDate();
											document.write(y+"-"+m+"-"+d);
											</script>
										</div>
										<div id="event-pane" class="lshpane-sliders">
											<div class="events_day d21_11_2013" >
												<span class="date"></span>        <!-- main container of a slide -->

							
													<div id="channelsCur">
														

													</div>
											</div>
										</div>
										<script id="tmpdataChannels" type="text/x-jquery-tmpl">
											<div class="lshpanel" id="e31930">
												<!-- slide arrea 22px along with flag, event title and date  -->
												<h3 class="  about-channel-h3 lshtitle eventtitle31930 lshjpane-toggler-down" style="background: url('images/${icon_type}') no-repeat scroll right center #F6F6F6;">
													<table cellpadding="0" cellspacing="0" border="0">
														<tbody>
															<tr>
																<td valign="middle" width="20px;" height="20px;" style="padding:0px 0px 0px 5px; background: url('upload/${url_icon}') no-repeat scroll  center;"></td>
																<td valign="middle" style="padding:0px 0px 0px 5px;"><span class="lshstart_time"><span class="t">${hour}:${minutes}</span></span></td>
																{{if status==0 }}
																<td valign="middle" style="padding:0px 0px 0px 5px;"><span class="lshevent">${channel_type_name}: ${name_of_channel}</span></td>
																{{else}}
																<td valign="middle" style="padding:0px 0px 0px 5px;"><span class="lshevent">${name_of_channel}</span></td>
																{{/if}}
															</tr>
														</tbody>
													</table>
												</h3>
												
												<!-- slider area -->
												<div id="event31930" class="lshjpane-slider lshcontent" style="display:none;padding-top: 0px; border-top-width: medium; border-top-style: none; padding-bottom: 0px; border-bottom-width: medium; border-bottom-style: none; overflow: hidden; height: 100px;">
													<table width="100%" class="insideslidebg" cellpadding="0" cellspacing="0" border="0">
														<tbody>
															<tr>
																<td class="infoblock" colspan="2">
																	<b>Live Streaming Video </b>
																	<span class="section">${name_of_channel}</span> -
																	<span id="category658" class="category">${channel_type_name}</span>
																	<div style="float: right; padding-right: 2px;">
																		<a class="open_event_tab" target="_blank" href="/watch.php?id=${channel_id}">
																			open event
																		</a>
																	</div>
																</td>
															</tr>
															<tr>
																<td class="infoblock">
																	<a href="/watch.php?id=${channel_id}">
																		<img style="vertical-align:text-bottom;" src="http://cdn.stream2u.eu/liveG.gif" border="0" alt="Zenit St Petersbrug vs Atletico Madrid" title="Zenit St Petersbrug vs Atletico Madrid">
																	<b>Watch ${name_of_channel} Live Streaming of 
																	${channel_type_name}
																	</b></a>
																</td>
																<td align="right">
																</td>
															</tr>
															<tr>
																<td colspan="2">
																	<br>
																	<table width="100%" cellpadding="0" cellspacing="0" border="0">
																		<tbody>
																			<tr class="sectiontableheader">
																				<td>Links to Watch ${channel_type_name} - ${name_of_channel} Live:</td>
																			</tr>
																		</tbody>
																	</table>
																	<table style="border-width: 0px; width: 100%;" border="0" cellspacing="0" cellpadding="0">
																		<tbody>
																			<tr class="sectiontableentry1">
																				<td width="18">
																					<img title="Iframe" src="http://cdn.stream2u.eu/flash.png" alt="Flash">
																				</td>
																				<td width="80">Flash:</td>
																				<td>
																				{{each(prop, val) flash}}
																					  <a href="/watch.php?id=${channel_id}&embled=${val.id}" target="_blank">Link#${prop+1}</a>
																				{{/each}}
																				</td>
																			</tr>
																		</tbody>
																	</table>
																</td>
															</tr>
														</tbody>
													</table>
												</div>
												<!-- close slider area -->
											</div>
										</script>
										<script>
										var dataChannels = <?php echo @json_encode($channels);?>;
										var dataChannelsCurr = <?php echo @json_encode($channelsCurr);?>;

										$().ready(function(e){
											var channels = $.tmpl($("#tmpdataChannels"), dataChannels);
											$("#dataChannels").html(channels);
											
											var channelscur = $.tmpl($("#tmpdataChannels"), dataChannelsCurr);
											$("#channelsCur").html(channelscur);
										});
										
										</script>
									</dd>
									<script>
									$().ready(function(e){
										$(".filter-cat").live('click',function(e){
											var _this = $(this);
											$("#dataChannels, #dataAboutChannels").html('');
											$("#dataChannels").prepend('<div style="margin:0 auto; width:50px;"><img src="/images/ajax-loader.gif"></div>');
											
											$.get(_this.attr('lhref'),function(res){
												$('.icon-livematches').attr('style',"background: url("+res.icon+") no-repeat scroll 0 0 transparent;");
												if(res.error){
													$("#dataChannels").html("");
												}else{
													
													var datachannels = $.tmpl($("#tmpdataChannels"), res.data);
													$("#dataChannels").html(datachannels);
													
												}
												$('.headertext').html(res.titleHeader);
												var aboutChannel = res.aboutChannel;
												var iaboutChannel = $.tmpl($("#tmpdataAboutChannels"), aboutChannel);
												$("#dataAboutChannels").html(iaboutChannel);
											});
										});

									});
									</script>
									<!-- main container after dd for sliders -->
									<!-- close lshcurrent -->
								</div>
								
							</td>
						</tr>
					</table>
				</div>
			</div>
			<div class="sidebar">
				<div class="for-webmasters">
					<div class="mask-webmasters">
						<div class="webmasters-head">
							<img src="<?php echo baseurl;?>streamhunter/images/for-webmasters.png" />
							<span>For Webmasters</span>
						</div>
					</div>
					<div class="webmasters-body">
						<div class="text">Put our Sport Streams Widget on your website!</div>
						<div class="mask-yellow-button">
							<a href="for-webmasters.html" class="yellow-button"><span>Read More</span></a>
						</div>
					</div>
				</div>
				<div class="for-streamers">
					<div class="mask-streamers">
						<div class="streamers-head">
							<img src="<?php echo baseurl;?>streamhunter/images/for-streamers.png" />
							<span>For Streamers</span>
						</div>
					</div>
					<div class="streamers-body">
						<div class="text">Add your Stream adresses to Stream Hunter!</div>
						<div class="mask-yellow-button">
							<a href="add-your-stream.html" class="yellow-button"><span>Read More</span></a>
						</div>
					</div>
				</div>
				<!--<div class="find-facebook">
					<iframe frameborder="0" scrolling="no" allowtransparency="true" style="border: medium none; overflow: hidden; width:234px; height: 270px;" src="http://www.facebook.com/plugins/fan.php?api_key=&amp;sdk=joey&amp;connections=8&amp;css=http%3A%2F%2Fwww.streamhunter.eu%2Ffb.css%3F13&amp;height=270&amp;id=507141305994897&amp;logobar=false&amp;stream=false&amp;width=244"/></iframe>
				</div>-->
				<div class="clear"></div>
			</div>
		</div>
	</div>
</div>